import Skeleton from "@/components/Skeleton";
import { useDreadcrumb } from "@/hooks";
import { PageContainer } from "@ant-design/pro-components";
import React from "react";

interface PageCommonProps {
  skeleton?: boolean;
  children?: any;
}

const PageCommon: React.FC<PageCommonProps> = ({ children, skeleton = true }) => {
  const breadcrumb = useDreadcrumb();

  return (
    <PageContainer
      header={{
        title: null,
        breadcrumb
      }}
      className="page-common"
    >
      {skeleton ? (
        <Skeleton type="header&table" size={2}>
          {children}
        </Skeleton>
      ) : (
        children
      )}
    </PageContainer>
  );
};

export default PageCommon;
